const http = uni.$u.http
const baseURL = 'http://192.168.1.2:8360';
//获取登陆数据
export const getLogin = (data) => http.post('/api/auth/login', data)
//首页
//get请求，获取首页数据
export const getHomeData = () => http.get('/api/index/home')
//获取市场数据
export const getMarkStore = () => http.get('/api/index/getMarketStore', {
	params: {
		category_id,
		province,
		city,
		district,
		page,
		limit
	}
})
//新加市场接口
export const addMarkStore = () => http.post('/api/user/addMarketStore', {
	logo_img, // logo,
	name, // 市场名字,
	shot_name, // 市场简称,
	address, // 地址,
	online_time, // 营业时间,
	phone, // 电话,
	introduce, // 介绍,
	category_id // 导航id,
})
//协议获取接口
export const getAgreement = (id) => http.get('/api/index/getAgreement', {
	params: {
		id
	}
})
//协议获取接口
export const getAgreementData = (data) => http.get('/api/index/getAgreement', {
	params: data
})

//我的
//银行卡接口
export const getBank = () => http.get('/api/user/getcardList')
//提交银行卡
export const sendBank = (data) => http.post('/api/user/cardSubmit', data)
//删除银行卡
export const deleteBank = () => http.get(' /api/user/delcard', {
	params: {
		id
	}
})
//充值列表
export const getRechargeList = () => http.get(' /api/index/getRechargeList')
//获取加盟费接口
export const getRecharge = () => http.get('/api/index/getRechargeList', {
	params: {
		id
	}
})



// export const getAddress = ()=> http.get(\)


// 获取用户订单信息
export const getAddStoreInfo = (data) => http.get('/api/store/getAddStoreInfo',{params:data})
// 获取入驻费用
export const getEntryFee = (data) => http.get('/api/index/getEntryFee',{params:data})
// 获取用户订单信息
export const getOrderStatus = (data) => http.get('/api/user/getOrderStatus',{params:data})
// 获取用户订单list
export const getOrderList = (data) => http.get('/api/user/getOrderList',{params:data})
// 根据id 获取市场列表 查询参数 navId 行业ID name 市场名字  province 省 city 市  district 区
export const getMarkListById = (data) => http.get('/api/index/getMarkListById',{params:data})
// 根基市场Id获取商家
export const getStoreListById = (data) => http.get('/api/index/getStoreListById',{params:data})
// h获取商品全部评论
export const getCommentListById = (data) => http.get('/api/index/getCommentListById',{params:data})
// 获取商家商品列表
export const getStoreGoodsList = (data) => http.get('/api/store/getStoreGoodsList',{params:data})
export const getHomeStoreGoodsList = (data) => http.get('/api/index/getStoreGoodsList',{params:data})
// 获取用户入驻的商户 
export const getUserStoreList = (data) => http.get('/api/store/getUserStoreList',{params:data})
// 根据id 获取商品详情
export const getGoodsInfoById = (data) => http.get('/api/index/getGoodsInfoById',{params:data})
export const getGoodsById = (data) => http.get('/api/index/getGoodsById',{params:data})
// 根据id 查询分类
export const getCategoryList = (data) => http.get('/api/index/getCategoryList',{params:data})
// 根据id 查询分类
export const getUserStoreInfo = (data) => http.get('/api/store/getUserStoreInfo',{params:data})
// 商品上架、下架接口
export const saveStoreGoods = (data) => http.post('/api/store/saveStoreGoods', data)
// 商品订单接口
export const orderConfim = (data) => http.post('/api/order/orderConfim', data)
// 获取商家订单
export const getUserStoreOrderList = (data) => http.get('/api/order/getUserStoreOrderList',{params:data})
// 订单修改接口
export const saveOrder = (data) => http.post('/api/order/saveOrder', data)
// 根据id 获取订单详情
export const getOrderInfoById = (data) => http.get('/api/order/getOrderInfoById',{params:data})
// 订单评论接口
export const orderComment = (data) => http.post('/api/order/orderComment', data)
// 订单删除接口
export const delOrderById = (data) => http.post('/api/order/delOrderById', data)
// 商品收藏、取消收藏接口
export const collection = (data) => http.post('/api/store/collection', data)
// 获取用户默认地址
export const getUserAddressDefalut = () => http.get('/api/user/getUserAddressDefalut')
// 商品添加初始化接口
export const getStoreInfo = (data) => http.post('/api/store/getStoreInfo', data)


// 商品添加、编辑接口
export const submitStoreGoods = (data) => http.post('/api/store/submitStoreGoods', data)
// 退款申请
export const retreatOrder = (data) => http.post('/api/user/retreatOrder', data)
// 取消退款申请
export const cancelRetreatOrder = (data) => http.post('/api/user/cancelRetreatOrder', data)
// 通过退款申请
export const comfigretreatOrder = (data) => http.post('/api/user/comfigretreatOrder', data)
// 退款申请
export const getRetreatOrderList = (data) => http.get('/api/user/getRetreatOrderList',{params:data})
// 获取用户账变记录
export const getUserReproy = (data) => http.get('/api/user/getUserReproy',{params:data})
// 图片上传统一接口 fileName 需要问一下后端！！！！！！！！ 参考页面 modeuleD/hongShanHun/addShop
export const uploadImg = (data) => {
	return new Promise((resolve, reject) => {
		let a = uni.uploadFile({
			url: baseURL+'/api/upload/img', // 仅为示例，非真实的接口地址
			filePath: data.url,
			name: 'file',
			formData: {
				fileName: data.fileName
			},
			success: (res) => {
				const data = JSON.parse(res.data)
				resolve(data.data.fileUrl)
			}
		});
	})
}
// 视频上传统一接口 fileName 需要问一下后端！！！！！！！！参考页面 modeuleD/hongShanHun/addShop
export const uploadVideo = (data) => {
	return new Promise((resolve, reject) => {
		let a = uni.uploadFile({
			url: baseURL+'/api/upload/video', // 仅为示例，非真实的接口地址
			filePath: data.url,
			name: 'file',
			formData: {
				fileName: data.fileName
			},
			success: (res) => {
				const data = JSON.parse(res.data)
				resolve(data.data.fileUrl)
			}
		});
	})
}

export const getAddress = ()=> http.get('/api/user/getAddress')
// 新增/修改收货地址接口
export const setAddress = (data) => http.post('/api/user/addressSubmit',data)
// 获取公司信息
export const getzytStore = () => http.get('/api/index/zytStore')


// 加入购物车
export const addCart = (data) => http.post('/api/cart/addCart', data)
// 删除购物车
export const delCartById = (data) => http.post('/api/cart/delCartById', data)
// 购物车选中、取消
export const cartCheckedById = (data) => http.post('/api/cart/cartCheckedById', data)
// 获取购物车
export const getCartList = (data) => http.get('/api/cart/getCartList',{params:data});
// 订单提交页面获取购物车
export const getCartGoodsList = (data) => http.get('/api/cart/getCartGoodsList',{params:data});
// 获取消息
export const getMsgList = (data) => http.post('/api/user/getMsgList', data)
// 获取消息
export const getStoreMsgList = (data) => http.post('/api/user/getStoreMsgList', data)
// 发送消息
export const sendMsg = (data) => http.post('/api/user/sendMsg', data)
// 获取用户消息列表
export const getUserMsgList = (data) => http.post('/api/user/getUserMsgList', data)
// 市场新加
export const addMarketStore = (data) => http.post('/api/index/addMarketStore', data)
// 招商入驻接口
export const addAttract = (data) => http.post('/api/store/addAttract', data)
// 招商入驻接口
export const getAttract = (data) => http.post('/api/store/getAttract', data)
// 获取招商经理列表
export const getAttractList = (data) => http.post('/api/store/getAttractList', data)
// 古玩入驻接口
export const addStore = (data) => http.post('/api/store/addStore', data)

